<?php include '../public/header.php' ?>
<?php include '../public/header_public.php' ?>
<body class="laytp-container">
<div style="height: 45px"></div>
<div id="opt_nav">
</div>
<div id="dialog">
    <div class="page-title" id="page-title">
        <div class="page-title-con">
            <span class="title">预算项信息</span>
            <div class="move_title"></div>
            <div class="page-title-opt-list">
                <span id="page-close" class="page-close" onclick="layer_close()">×</span>
            </div>
        </div>
    </div>
</div>


<div class="layui-card" id="table-card">
    <div class="layui-card-body">
        <div class="layui-row">
            <div class="layui-col-md12" id="table_list">
                <div class="layui-card-body">
                    <table id="datalist" lay-filter="datalist"></table>
                </div>
            </div>
        </div>
    </div>
</div>
<script type="text/html" id="toolbarDemo">
    <div class = "layui-btn-container">
    </div>
</script>
<script>
    var param_listid = getQueryVariable('listid') || 0;
    layui.use(["laytp",'laypage','table','dropdown','form','soulTable'], function () {
        var laypage = layui.laypage, table = layui.table, dropdown = layui.dropdown, form = layui.form, soulTable = layui.soulTable;

        $('#TableSearchReset').click(function () {
            $('.xmselect_div>xm-select').find('.xm-label-block').css('display','none');
            $('.xmselect_div').append('<div class="xmselect_title">请选择</div>');
            searchTableFunc(form, table)
        });

        var mytable = table.render({
            elem: "#datalist",id: "datalist"
            ,url: facade.url(ask_contract_cai_bglist_show),where: {listid:param_listid}, page: false
            ,soulSort: TabInit.soulSort,method: TabInit.method, toolbar: TabInit.toolbar, overflow: TabInit.overflow
            ,defaultToolbar: TabInit.defaultToolbar,filter: TabInit.filter
            ,request: TabInit.request,response: TabInit.response,contextmenu:get_table_contextmenu(soulTable)
            ,text: TabInit.text,totalRow: true
            ,parseData: function (res) {

                render_from();
                return {
                    "code": res.code,
                    "msg": res.message,
                    "count": res.data.total,
                    "data": res.data.data
                };
            }
            , cols: [[
                {type: "checkbox", fixed: 'left'}
                ,{type:'numbers',title:'序号',totalRowText: '合计',fixed:'left'}
                ,{field: 'subname', title: '科目'}
                ,{field: 'jinname', title: '#'}
                ,{field:'name',title:'名称及规格',templet: function(d){
                        if(d.ishetong == 1){
                            return '<span class="colorlan" onclick="openPage(\'../contract_cai/show.php?id='+d.hetongid+'\')">'+d.name+'</span>';
                        }else{
                            return d.name;
                        }
                    }}
                ,{field: 'unit', title: '单位'}
                ,{field: 'num', title: '预算数量',align:'right'}
                ,{field: 'price', title: '预算单价(元)',align:'right'}
                ,{field: 'money', title: '预算金额(元)',align:'right'}
                ,{field: 'list_num', title: '采购数量',align:'right'}
                ,{field: 'list_money', title: '采购金额(元)',align:'right'}
                ,{field: 'avamoney', title: '采购均价(元)',align:'right'}
                ,{field:'shengnum',title:'剩余数量',align:'right',templet: function(d){
                        if(d.shengnum == '/'){
                            return d.shengnum;
                        }else{
                            if(d.shengnum < 0){
                                return '<span class="colorhong">'+d.shengnum+'</span>';
                            }else{
                                return d.shengnum;
                            }
                        }
                    }}
                ,{field:'shengmoney',title:'剩余金额(元)',align:'right',templet: function(d){
                        if(d.shengmoney == '/'){
                            return d.shengmoney;
                        }else{
                            if(d.shengmoney < 0){
                                return '<span class="colorhong">'+d.shengmoney+'</span>';
                            }else{
                                return d.shengmoney;
                            }
                        }
                    }}
            ]]
            , done: function (res) {
                soulTable.render(this);

            }
        });


        listTableSearch(form, table);
    });


</script>
</body>
</html>
